package com.AEWMS.Test;

import com.AEWMS.Dao.ScoreWarningRank;
import com.AEWMS.Pojo.ScoreWarningRankView;
import com.AEWMS.Service.ScoreWarnRankService;
import com.alibaba.fastjson.JSON;

import java.util.ArrayList;

public class ScoreWarnTest {
    public static void main(String[] args) {
//        ScoreWarningRankView v = new ScoreWarningRankView();
//        ScoreWarnRankService s = new ScoreWarnRankService();
////        System.out.println(JSON.toJSONString(s.findAllScoreWarningRank()));
////        System.out.println(JSON.toJSONString(s.findScoreWarningRankById("117583030114")));
//        ScoreWarningRank r = new ScoreWarningRank();
////        r.setWarningId(6);
////        r.setWarningRank("粉色预警");
////        r.setWarningStandardStart(11);
////        r.setWarningStandardEnd(15);
////        System.out.println(s.deleteScoreWarningRankById("5"));
//        System.out.println(s.deleteScoreWarningRankById("7"));

        ScoreWarningRankView s = new ScoreWarningRankView();
        ScoreWarnRankService sws = new ScoreWarnRankService();

        // 获取所有学生信息
        ArrayList<ScoreWarningRankView> srv = sws.findAllScoreWarningRank();
        System.out.println(JSON.toJSONString(srv));

        // 获取降级标准
        ArrayList<ScoreWarningRank> scoreWarningRank = sws.findAllScoreWarningRankNotView();
        System.out.println(JSON.toJSONString(scoreWarningRank));
        int baozhun = 0;
        for(ScoreWarningRank sw : scoreWarningRank){
            if (sw.getWarningRank().equals("降级")) {
                baozhun = sw.getWarningStandardStart();
            }
        }
        System.out.println(baozhun);

//        // 处理降级学生信息
//        for(ScoreWarningRankView sw : srv){
//            if (sw.getCourseType().equals("必修课")) {
//                if(sw.getFailExams() < baozhun){
//                    sw.setIsDown(true);
//                }
//                System.out.println(JSON.toJSONString(sw));
//            }
//        }

//        if (s.getFailExams() > baozhun) {
//            s.setDown(true);
//        }
    }
}







